﻿using System;
using System.Data;
using System.Data.SqlClient;

namespace Helper.DalHelper
{
	public static class SqlParameterBuilder
	{
		public static SqlParameter CreateSqlParameter(string pParamName, SqlDbType pSqltype, object pValue)
		{
			SqlParameter mParam = new SqlParameter(pParamName, pSqltype);

			if (pValue == null)
				mParam.Value = DBNull.Value;
			else
				mParam.Value = pValue;

			return mParam;
		}

		public static SqlParameter CreateSqlParameter(string pParamName, SqlDbType pSqltype, object pValue, int pParameterSize)
		{
			SqlParameter mParam = new SqlParameter(pParamName, pSqltype, pParameterSize);

			if (pValue == null)
				mParam.Value = DBNull.Value;
			else
				mParam.Value = pValue;

			return mParam;
		}

	}
}
